From: Marco Trevisan (TreviƱo) Date: Thu, 9 May 2019 19:30:21 +0000 (-0500) Subject: keyboard: Unset current page when it gets destroyed X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~845^2^2~219 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c0c2edf2e1162bb36ad93ab015a64b7dedbd7cec;p=gnome-shell.git keyboard: Unset current page when it gets destroyed The current page is going to be destroyed as part of _onKeyboardGroupsChanged cleanup, however we don't unset its pointer, and thus we'd might try to call a function using an invalidated pointer. So, unset the this._current_page reference when its get destroyed, connecting to destroy signal when setting it and disconnecting when changing page. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1281 https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/540 --- diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index fbba2840e..a67d08f1e 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -1522,10 +1522,15 @@ var Keyboard = class Keyboard { if (this._current_page != null) { this._setCurrentLevelLatched(this._current_page, false); + this._current_page.disconnect(this._current_page._destroyID); this._current_page.hide(); + delete this._current_page._destroyID; } this._current_page = layers[activeLevel]; + this._current_page._destroyID = this._current_page.connect('destroy', () => { + this._current_page = null; + }); this._updateCurrentPageVisible(); }